<template>
	<view>
		<u-table :align="align" :borderColor="borderColor">
			<u-tr class="u-tr" style="line-height: 28px;">
				<u-th width="25%" class="u-th u-th-name">站名</u-th>
				<u-th width="30%" class="u-th u-th-upz">黄海(吴淞水位)</u-th>
				<u-th width="15%" class="u-th">超警戒</u-th>
				<u-th width="15%" class="u-th">超保证</u-th>
				<u-th width="15%" class="u-th">时间</u-th>
			</u-tr>
			<u-tr class="u-tr" style="line-height: 28px;" v-for="(item,index) in newlist" :key="index" :class="'tr-color-' + index % 2">
				<u-td class="u-td" width="25%"><view class="u-font-14" @click="handleClick(item.STCD,item.STNM)">{{item.STNM}}</view></u-td>
				<u-td class="u-td" width="30%"><view class="u-font-14" @click="handleClick(item.STCD,item.STNM)">{{ undefined != item.UPZ && "" != item.UPZ ? p.changeTwoDecimal(item.UPZ,2) : "—" }}({{undefined != item.UPZ && "" != item.UPZ ? p.changeTwoDecimal(item.UPZ + 1.84,2) : "—"}})</view></u-td>
				<u-td class="u-td" width="15%"><view class="u-font-14" @click="handleClick(item.STCD,item.STNM)">{{ undefined != item.WRZ && "" != item.WRZ ? p.changeTwoDecimal(item.WRZ,2) : "—" }}</view></u-td>
				<u-td class="u-td" width="15%"><view class="u-font-14" @click="handleClick(item.STCD,item.STNM)">{{ undefined != item.GRZ && "" != item.GRZ ? p.changeTwoDecimal(item.GRZ,2) : "—" }}</view></u-td>
				<u-td class="u-td" width="15%"><view class="u-font-14" @click="handleClick(item.STCD,item.STNM)">{{$u.timeFormat(formatTime.convertToDate(item.TM),'hh:MM')}}</view></u-td>
			</u-tr>
		</u-table>
	</view>
</template>

<script>
	import {getWaterInfo ,getWaterInfos} from '../api/api.js'
	export default {
		data() {
			return {
				result: [],
				borderColor: '#e4e7ed',
				align: 'center'
			}
		},
		name: "WaterList",
		//属性
		props: {
			stcd: {
				type: String, //属性类型
				value: ""
			},
			newlist:{
				type:Array,
				required:true,
			}
		},
		//组件生命周期
		created: function(e) {

		}, 
		mounted(){
			this.search()
		},
		methods: {
			handleClick(stcd,stnm){ 
				//跳转 （myClick为父组件中定义的方法）
				this.$emit('myClick',stcd,stnm);
			},
			search() {
				//newlist 接收父组件传递的参数,只能调用一次
				// this.result = this.newlist
			}
		}
	}
</script>

<style scoped>
	.u-card-wrap {
		background-color: $u-bg-color;
		padding: 1px;
	}

	.u-body-item {
		font-size: 32rpx;
		color: #333;
		padding: 20rpx 10rpx;
	}
	
	
	.tr-color-0 {
		background: #fff;
	}
	.tr-color-1 {
		background: #f0f0f0;
	}
	
	.u-th{font-size: 26rpx;}
	.u-th-name{font-size: 26rpx;}
	.u-th-upz{font-size: 26rpx;}
</style>
